package com.zwj.design.behavior.strategy;

import com.zwj.design.behavior.strategy.behavior.impl.FlyRocketPowered;
import com.zwj.design.behavior.strategy.duck.Duck;
import com.zwj.design.behavior.strategy.duck.impl.MallardDuck;
import com.zwj.design.behavior.strategy.duck.impl.ModelDuck;

/**
 * 策略模式案例
 *
 * @author 张文接
 * @version 1.0
 * @createTime 2024/3/14 22:17
 */
public class Demo {
    public static void main(String[] args) {
        Duck mallardDuck = new MallardDuck();
        mallardDuck.display();
        mallardDuck.performFly();
        mallardDuck.performQuack();

        Duck modelDuck = new ModelDuck();
        modelDuck.display();
        modelDuck.performFly();
        modelDuck.performQuack();
        modelDuck.setFlyBehavior(new FlyRocketPowered());
        modelDuck.performFly();
    }
}
